﻿using System;
using CommonLibrary.Models.ControllerStates.PS3;

namespace ConnectionManager.Models
{
    class PS3BTReport
    {
        public void SixaxisInit(PS3ControllerState sixaxisState)
        {
            sixaxisState.Sys.ReportingEnabled = 0;
            sixaxisState.Sys.FeatureEfByte6 = 0xb0;
        }

        public int SixaxisPeriodicReport(PS3ControllerState sixaxisState)
        {
            return sixaxisState.Sys.ReportingEnabled;
        }
        /*
        private const int[] DigitalOrder = new int[17]
                                               {
                                                    sb_select, sb_l3, sb_r3, sb_start,
                                                    sb_up, sb_right, sb_down, sb_left,
                                                    sb_l2, sb_r2, sb_l1, sb_r1,
                                                    sb_triangle, sb_circle, sb_cross, sb_square,
                                                    sb_ps
                                               };

        private const int[] AnalogOrder = new int[12]
                                               {
                                                    sb_up, sb_right, sb_down, sb_left,
                                                    sb_l2, sb_r2, sb_l1, sb_r1,
                                                    sb_triangle, sb_circle, sb_cross, sb_square 
                                               };

        public int AssembleInput01(ref byte buf, int maxlen, PS3ControllerState state)
        {
            if (maxlen < 48) return -1;

            for (int i = 0; i < 17; i++)
            {
                int bytez = 1 + (i/8);
                int offset = i % 8;
                if (state.User.Buttons.GetInDigitalOrder(i).Pressed)
                    buf[bytez] |= (byte) (1 << offset);
            }
        }*/
    }
}
